
import ajax from './index'

export function next_no(type) {
    return ajax({
        url: "/backend/generate/id/" + type,
        method: "get"
    });
}

export function fetchUploadGroup(mediaType) {
    return ajax({
        url: '/backend/file/group/' + mediaType,
        method: 'get'
    });
}

export function uploadSubmit(data) {
    return ajax({
        url: '/backend/files/upload',
        method: 'post',
        data
    });
}

export function getUploadList(query) {
    return ajax({
        url: '/backend/files/image',
        method: 'get',
        params: query
    });
}

export function getUploadToken(groupCode) {
    return ajax({
        url: '/backend/files/upload_token/image/' + groupCode,
        method: 'get'
    });
}


export function createFileGroup(data) {
    return ajax({
        url: '/backend/file/group/create',
        method: 'post',
        data: data
    });
}

export function editFileGroup(data) {
    return ajax({
        url: '/backend/file/group/update/' + data.id,
        method: 'post',
        data: data
    });
}

export function deleteFileGroup(id) {
    return ajax({
        url: '/backend/file/group/delete/' + id,
        method: 'post',
    });
}

export function deleteFile(id) {
    return ajax({
        url: '/backend/files/delete/' + id,
        method: 'post',
    });
}